<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>打开窗口</title>
</head>
<body>
	<a href="javascript:return false;" onclick="openTab();">打开百度</a>
	<a href="javascript:return false;" onclick="closeTab();">关闭</a>
	<!-- <iframe src="" name="myframe"></iframe> -->
	<script type="text/javascript">
		var myWind = null;
		openTab();
		function openTab() {
			myWind = window.open('http://www.baidu.com', 'myframe');
		};
		function closeTab() {
			myWind === null? alert('窗口不存在！'): myWind.close();
		}
	</script>
</body>
</html>